import request from '@/utils/http'

/**
 * 获取回复列表API
 *
 * @param params 查询参数对象
 * @returns 返回Promise对象，解析后为回复列表对象
 */
export const replyListApi = (params: any) => {
  return request.get('/api/reply', { params })
}

/**
 * 获取回复详情API
 *
 * @param rid 回复ID
 * @returns 返回Promise对象，解析后为回复详情对象
 */
export const replyDetailApi = (rid: string) => {
  return request.get(`/api/reply/${rid}`)
}

/**
 * 获取我的回复API
 * 
 * @param params 查询参数对象
 * @returns 返回Promise对象，解析后为我的回复列表对象
 */
export const myReplyListApi = (params: any) => {
  return request.get('/api/reply/my_reply', { params })
}

/**
 * 创建回复API
 * 
 * @param params 回复参数对象
 * @returns 返回Promise对象，解析后为发布成功或失败的信息
 */
export const publishReplyApi = (params: any) => {
  return request.post('/api/reply', params)
}

/**
 * 更新回复API
 * 
 * @param rid 回复ID
 * @param params 回复参数对象
 * @returns 返回Promise对象，解析后为更新成功或失败的信息
 */
export const updateReplyApi = (rid: string, params: any) => {
  return request.put(`/api/reply/${rid}`, params)
}

/**
 * 删除回复API
 * 
 * @param rid 回复ID
 * @returns 返回Promise对象，解析后为删除成功或失败的信息
 */
export const deleteReplyApi = (rid: string) => {
  return request.delete(`/api/reply/${rid}`)
}